feat: (PRO-343) Improve estimate fee efficiency for different Price T…#226
Merged
dev-jodee merged 1 commit intorelease/feature-freeze-for-auditfrom Sep 29, 2025
Conversation
…ype (Free -> instant, Fixed -> just calculate price), Margin -> the full calculation
Contributor
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 0c437c6 in 1 minute and 30 seconds. Click for details.
- Reviewed
362lines of code in3files - Skipped
0files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/fee/fee.rs:39
- Draft comment:
Consider adding doc comments for the new() and new_fixed() constructors for clarity. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
2. crates/lib/src/fee/fee.rs:289
- Draft comment:
The match on PriceModel (Free, Fixed, Margin) cleanly separates fee calculation paths. Confirm that using new_fixed for Fixed and new for Margin correctly represents the fee breakdown. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
3. crates/lib/src/fee/price.rs:29
- Draft comment:
In get_required_lamports_with_fixed, consider providing a more descriptive error if the PriceModel is not Fixed. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
4. crates/lib/src/fee/price.rs:51
- Draft comment:
The margin calculation correctly checks for overflow. Consider enforcing or documenting that margin values should be non-negative to avoid unintended fee reductions. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
5. crates/lib/src/rpc_server/method/transfer_transaction.rs:170
- Draft comment:
Test update: Changing the source string from 'invalid_pubkey' to 'invalid' properly triggers Pubkey::from_str error. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is purely informative, describing a change in a test case without suggesting any action or asking for clarification. It doesn't provide any actionable feedback or raise any concerns about the code.
Workflow ID: wflow_5F82XkaGSOXFhQLr
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
amilz
approved these changes
Sep 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ype (Free -> instant, Fixed -> just calculate price), Margin -> the full calculation
Important
Improves fee estimation efficiency by handling different price models (Free, Fixed, Margin) with new methods in
fee.rsandprice.rs.estimate_kora_fee()infee.rsnow handlesPriceModel::Free,PriceModel::Fixed, andPriceModel::Marginmore efficiently by using new methodsget_required_lamports_with_fixed()andget_required_lamports_with_margin().TotalFeeCalculationstruct infee.rsnow has anew_fixed()constructor for fixed fee scenarios.PriceConfiginprice.rsnow includesget_required_lamports_with_fixed()andget_required_lamports_with_margin()for calculating fees based onPriceModel.price.rsandfee.rsto cover new fee calculation methods and scenarios.transfer_transaction.rsto fix a test case by renamingsourcetoinvalid.This description was created by
for 0c437c6. You can customize this summary. It will automatically update as commits are pushed.
📊 Unit Test Coverage
Unit Test Coverage: 84.6%
View Detailed Coverage Report